package View;

import Engine.Engine;
import java.io.IOException;
import javax.swing.JOptionPane;

public class MainScreen extends javax.swing.JFrame {

    public MainScreen() {
        initComponents();
        this.rootPane.setDefaultButton(jButton1);
    }
    public String compartilhamento;

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jCheckBox1 = new javax.swing.JCheckBox();
        jCheckBox2 = new javax.swing.JCheckBox();
        jCheckBox3 = new javax.swing.JCheckBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jPanel3 = new javax.swing.JPanel();
        jCheckBox4 = new javax.swing.JCheckBox();
        jCheckBox5 = new javax.swing.JCheckBox();
        jCheckBox6 = new javax.swing.JCheckBox();
        jCheckBox7 = new javax.swing.JCheckBox();
        jCheckBox8 = new javax.swing.JCheckBox();
        jCheckBox9 = new javax.swing.JCheckBox();
        jCheckBox10 = new javax.swing.JCheckBox();
        jCheckBox11 = new javax.swing.JCheckBox();
        jComboBox1 = new javax.swing.JComboBox();
        jComboBox2 = new javax.swing.JComboBox();
        jCheckBox12 = new javax.swing.JCheckBox();
        jComboBox3 = new javax.swing.JComboBox();
        jSeparator1 = new javax.swing.JSeparator();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        jPanel5 = new javax.swing.JPanel();
        jTextField1 = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("CPress v3.00");
        setResizable(false);

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Simples"));

        jCheckBox1.setText("Página de status da máquina");
        jCheckBox1.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jCheckBox1ItemStateChanged(evt);
            }
        });

        jCheckBox2.setText("Página de status de serviço da máquina");
        jCheckBox2.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jCheckBox2ItemStateChanged(evt);
            }
        });

        jCheckBox3.setText("Texto específico");
        jCheckBox3.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jCheckBox3ItemStateChanged(evt);
            }
        });

        jTextArea1.setColumns(20);
        jTextArea1.setLineWrap(true);
        jTextArea1.setRows(5);
        jTextArea1.setWrapStyleWord(true);
        jScrollPane1.setViewportView(jTextArea1);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jCheckBox2)
                            .addComponent(jCheckBox3)
                            .addComponent(jCheckBox1))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jCheckBox1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 11, Short.MAX_VALUE))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("FRPO"));

        jCheckBox4.setText("Repor nome original do equipamento");

        jCheckBox5.setText("Anular A4 / Carta");

        jCheckBox6.setText("Anular Press GO");

        jCheckBox7.setText("Repor configurações padrões do equipamento");
        jCheckBox7.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jCheckBox7ItemStateChanged(evt);
            }
        });

        jCheckBox8.setText("Reiniciar o firmware");
        jCheckBox8.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jCheckBox8ItemStateChanged(evt);
            }
        });

        jCheckBox9.setText("Ajuste de bordas de notas #1");
        jCheckBox9.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jCheckBox9ItemStateChanged(evt);
            }
        });

        jCheckBox10.setText("Ajuste de bordas de notas #2");
        jCheckBox10.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jCheckBox10ItemStateChanged(evt);
            }
        });

        jCheckBox11.setText("Ajustar tamanho do cassete");

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4" }));

        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Carta", "Legal", "A4", "B5", "A5" }));

        jCheckBox12.setText("Ajustar tamanho da bandeja MP");

        jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Carta", "Legal", "A4", "B5", "A5" }));

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSeparator1)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jCheckBox4)
                            .addComponent(jCheckBox5)
                            .addComponent(jCheckBox6)
                            .addComponent(jCheckBox7)
                            .addComponent(jCheckBox8)
                            .addComponent(jCheckBox9)
                            .addComponent(jCheckBox10)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jCheckBox11)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jCheckBox12)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 42, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jCheckBox4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox8)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jCheckBox11)
                            .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCheckBox12))
                    .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox9)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox10))
        );

        jButton1.setText("Enviar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("Avançado");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton1)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(65, 65, 65)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jButton1)
                        .addComponent(jButton2)))
                .addContainerGap())
        );

        jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel1.setText("Nome ou IP do sistema de impressão");

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 4, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel1)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(jTextField1))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(1, 1, 1)
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jLabel2.setBackground(new java.awt.Color(255, 102, 102));
        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/CPress3.png"))); // NOI18N

        jMenu1.setText("Sistema de impressão");

        jMenuItem3.setText("Mapear sistema de impressão");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem3);

        jMenuItem4.setText("Desconectar sistema de impressão");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem4);

        jMenuItem5.setText("Mapear com IP");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem5);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Sobre");

        jMenuItem1.setText("CPress v3.00");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem1);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(6, 6, 6)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );

        pack();
        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        java.awt.Dimension dialogSize = getSize();
        setLocation((screenSize.width-dialogSize.width)/2,(screenSize.height-dialogSize.height)/2);
    }// </editor-fold>//GEN-END:initComponents

    private void jCheckBox1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBox1ItemStateChanged
        if (this.jCheckBox1.isSelected()) {
            this.jCheckBox2.setEnabled(false);
            this.jCheckBox3.setEnabled(false);
            this.jCheckBox4.setEnabled(false);
            this.jCheckBox5.setEnabled(false);
            this.jCheckBox6.setEnabled(false);
            this.jCheckBox7.setEnabled(false);
            this.jCheckBox8.setEnabled(false);
            this.jCheckBox9.setEnabled(false);
            this.jCheckBox10.setEnabled(false);
            this.jCheckBox11.setEnabled(false);
            this.jCheckBox12.setEnabled(false);
            this.jTextArea1.setEnabled(false);
            this.jComboBox1.setEnabled(false);
            this.jComboBox2.setEnabled(false);
            this.jComboBox3.setEnabled(false);
            this.jButton2.setEnabled(false);
        } else {
            this.jCheckBox2.setEnabled(true);
            this.jCheckBox3.setEnabled(true);
            this.jCheckBox4.setEnabled(true);
            this.jCheckBox5.setEnabled(true);
            this.jCheckBox6.setEnabled(true);
            this.jCheckBox7.setEnabled(true);
            this.jCheckBox8.setEnabled(true);
            this.jCheckBox9.setEnabled(true);
            this.jCheckBox10.setEnabled(true);
            this.jCheckBox11.setEnabled(true);
            this.jCheckBox12.setEnabled(true);
            this.jTextArea1.setEnabled(true);
            this.jComboBox1.setEnabled(true);
            this.jComboBox2.setEnabled(true);
            this.jComboBox3.setEnabled(true);
            this.jButton2.setEnabled(true);
        }
    }//GEN-LAST:event_jCheckBox1ItemStateChanged

    private void jCheckBox2ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBox2ItemStateChanged
        if (this.jCheckBox2.isSelected()) {
            this.jCheckBox1.setEnabled(false);
            this.jCheckBox3.setEnabled(false);
            this.jCheckBox4.setEnabled(false);
            this.jCheckBox5.setEnabled(false);
            this.jCheckBox6.setEnabled(false);
            this.jCheckBox7.setEnabled(false);
            this.jCheckBox8.setEnabled(false);
            this.jCheckBox9.setEnabled(false);
            this.jCheckBox10.setEnabled(false);
            this.jCheckBox11.setEnabled(false);
            this.jCheckBox12.setEnabled(false);
            this.jTextArea1.setEnabled(false);
            this.jComboBox1.setEnabled(false);
            this.jComboBox2.setEnabled(false);
            this.jComboBox3.setEnabled(false);
            this.jButton2.setEnabled(false);
        } else {
            this.jCheckBox1.setEnabled(true);
            this.jCheckBox3.setEnabled(true);
            this.jCheckBox4.setEnabled(true);
            this.jCheckBox5.setEnabled(true);
            this.jCheckBox6.setEnabled(true);
            this.jCheckBox7.setEnabled(true);
            this.jCheckBox8.setEnabled(true);
            this.jCheckBox9.setEnabled(true);
            this.jCheckBox10.setEnabled(true);
            this.jCheckBox11.setEnabled(true);
            this.jCheckBox12.setEnabled(true);
            this.jTextArea1.setEnabled(true);
            this.jComboBox1.setEnabled(true);
            this.jComboBox2.setEnabled(true);
            this.jComboBox3.setEnabled(true);
            this.jButton2.setEnabled(true);
        }
    }//GEN-LAST:event_jCheckBox2ItemStateChanged

    private void jCheckBox3ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBox3ItemStateChanged
        if (this.jCheckBox3.isSelected()) {
            this.jCheckBox1.setEnabled(false);
            this.jCheckBox2.setEnabled(false);
            this.jCheckBox4.setEnabled(false);
            this.jCheckBox5.setEnabled(false);
            this.jCheckBox6.setEnabled(false);
            this.jCheckBox7.setEnabled(false);
            this.jCheckBox8.setEnabled(false);
            this.jCheckBox9.setEnabled(false);
            this.jCheckBox10.setEnabled(false);
            this.jCheckBox11.setEnabled(false);
            this.jCheckBox12.setEnabled(false);
            this.jComboBox1.setEnabled(false);
            this.jComboBox2.setEnabled(false);
            this.jComboBox3.setEnabled(false);
            this.jButton2.setEnabled(false);
        } else {
            this.jCheckBox1.setEnabled(true);
            this.jCheckBox2.setEnabled(true);
            this.jCheckBox4.setEnabled(true);
            this.jCheckBox5.setEnabled(true);
            this.jCheckBox6.setEnabled(true);
            this.jCheckBox7.setEnabled(true);
            this.jCheckBox8.setEnabled(true);
            this.jCheckBox9.setEnabled(true);
            this.jCheckBox10.setEnabled(true);
            this.jCheckBox11.setEnabled(true);
            this.jCheckBox12.setEnabled(true);
            this.jComboBox1.setEnabled(true);
            this.jComboBox2.setEnabled(true);
            this.jComboBox3.setEnabled(true);
            this.jButton2.setEnabled(true);
        }
    }//GEN-LAST:event_jCheckBox3ItemStateChanged

    private void jCheckBox9ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBox9ItemStateChanged
        if (this.jCheckBox9.isSelected()) {
            this.jCheckBox2.setEnabled(false);
            this.jCheckBox3.setEnabled(false);
            this.jCheckBox4.setEnabled(false);
            this.jCheckBox5.setEnabled(false);
            this.jCheckBox6.setEnabled(false);
            this.jCheckBox7.setEnabled(false);
            this.jCheckBox8.setEnabled(false);
            this.jCheckBox1.setEnabled(false);
            this.jCheckBox10.setEnabled(false);
            this.jCheckBox11.setEnabled(false);
            this.jCheckBox12.setEnabled(false);
            this.jTextArea1.setEnabled(false);
            this.jComboBox1.setEnabled(false);
            this.jComboBox2.setEnabled(false);
            this.jComboBox3.setEnabled(false);
            this.jButton2.setEnabled(false);
        } else {
            this.jCheckBox2.setEnabled(true);
            this.jCheckBox3.setEnabled(true);
            this.jCheckBox4.setEnabled(true);
            this.jCheckBox5.setEnabled(true);
            this.jCheckBox6.setEnabled(true);
            this.jCheckBox7.setEnabled(true);
            this.jCheckBox8.setEnabled(true);
            this.jCheckBox1.setEnabled(true);
            this.jCheckBox10.setEnabled(true);
            this.jCheckBox11.setEnabled(true);
            this.jCheckBox12.setEnabled(true);
            this.jTextArea1.setEnabled(true);
            this.jComboBox1.setEnabled(true);
            this.jComboBox2.setEnabled(true);
            this.jComboBox3.setEnabled(true);
            this.jButton2.setEnabled(true);
        }
    }//GEN-LAST:event_jCheckBox9ItemStateChanged

    private void jCheckBox10ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBox10ItemStateChanged
        if (this.jCheckBox10.isSelected()) {
            this.jCheckBox2.setEnabled(false);
            this.jCheckBox3.setEnabled(false);
            this.jCheckBox4.setEnabled(false);
            this.jCheckBox5.setEnabled(false);
            this.jCheckBox6.setEnabled(false);
            this.jCheckBox7.setEnabled(false);
            this.jCheckBox8.setEnabled(false);
            this.jCheckBox1.setEnabled(false);
            this.jCheckBox9.setEnabled(false);
            this.jCheckBox11.setEnabled(false);
            this.jCheckBox12.setEnabled(false);
            this.jTextArea1.setEnabled(false);
            this.jComboBox1.setEnabled(false);
            this.jComboBox2.setEnabled(false);
            this.jComboBox3.setEnabled(false);
            this.jButton2.setEnabled(false);
        } else {
            this.jCheckBox2.setEnabled(true);
            this.jCheckBox3.setEnabled(true);
            this.jCheckBox4.setEnabled(true);
            this.jCheckBox5.setEnabled(true);
            this.jCheckBox6.setEnabled(true);
            this.jCheckBox7.setEnabled(true);
            this.jCheckBox8.setEnabled(true);
            this.jCheckBox1.setEnabled(true);
            this.jCheckBox9.setEnabled(true);
            this.jCheckBox11.setEnabled(true);
            this.jCheckBox12.setEnabled(true);
            this.jTextArea1.setEnabled(true);
            this.jComboBox1.setEnabled(true);
            this.jComboBox2.setEnabled(true);
            this.jComboBox3.setEnabled(true);
            this.jButton2.setEnabled(true);
        }
    }//GEN-LAST:event_jCheckBox10ItemStateChanged

    private void jCheckBox7ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBox7ItemStateChanged
        if (this.jCheckBox7.isSelected()) {
            this.jCheckBox2.setEnabled(false);
            this.jCheckBox3.setEnabled(false);
            this.jCheckBox4.setEnabled(false);
            this.jCheckBox5.setEnabled(false);
            this.jCheckBox6.setEnabled(false);
            this.jCheckBox9.setEnabled(false);
            this.jCheckBox8.setEnabled(false);
            this.jCheckBox1.setEnabled(false);
            this.jCheckBox10.setEnabled(false);
            this.jCheckBox11.setEnabled(false);
            this.jCheckBox12.setEnabled(false);
            this.jTextArea1.setEnabled(false);
            this.jComboBox1.setEnabled(false);
            this.jComboBox2.setEnabled(false);
            this.jComboBox3.setEnabled(false);
            this.jButton2.setEnabled(false);

        } else {
            this.jCheckBox2.setEnabled(true);
            this.jCheckBox3.setEnabled(true);
            this.jCheckBox4.setEnabled(true);
            this.jCheckBox5.setEnabled(true);
            this.jCheckBox6.setEnabled(true);
            this.jCheckBox9.setEnabled(true);
            this.jCheckBox8.setEnabled(true);
            this.jCheckBox1.setEnabled(true);
            this.jCheckBox10.setEnabled(true);
            this.jCheckBox11.setEnabled(true);
            this.jCheckBox12.setEnabled(true);
            this.jTextArea1.setEnabled(true);
            this.jComboBox1.setEnabled(true);
            this.jComboBox2.setEnabled(true);
            this.jComboBox3.setEnabled(true);
            this.jButton2.setEnabled(true);
        }
    }//GEN-LAST:event_jCheckBox7ItemStateChanged

    private void jCheckBox8ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBox8ItemStateChanged
        if (this.jCheckBox8.isSelected()) {
            this.jCheckBox2.setEnabled(false);
            this.jCheckBox3.setEnabled(false);
            this.jCheckBox4.setEnabled(false);
            this.jCheckBox5.setEnabled(false);
            this.jCheckBox6.setEnabled(false);
            this.jCheckBox7.setEnabled(false);
            this.jCheckBox9.setEnabled(false);
            this.jCheckBox1.setEnabled(false);
            this.jCheckBox10.setEnabled(false);
            this.jCheckBox11.setEnabled(false);
            this.jCheckBox12.setEnabled(false);
            this.jTextArea1.setEnabled(false);
            this.jComboBox1.setEnabled(false);
            this.jComboBox2.setEnabled(false);
            this.jComboBox3.setEnabled(false);
            this.jButton2.setEnabled(false);

        } else {
            this.jCheckBox2.setEnabled(true);
            this.jCheckBox3.setEnabled(true);
            this.jCheckBox4.setEnabled(true);
            this.jCheckBox5.setEnabled(true);
            this.jCheckBox6.setEnabled(true);
            this.jCheckBox7.setEnabled(true);
            this.jCheckBox9.setEnabled(true);
            this.jCheckBox1.setEnabled(true);
            this.jCheckBox10.setEnabled(true);
            this.jCheckBox11.setEnabled(true);
            this.jCheckBox12.setEnabled(true);
            this.jTextArea1.setEnabled(true);
            this.jComboBox1.setEnabled(true);
            this.jComboBox2.setEnabled(true);
            this.jComboBox3.setEnabled(true);
            this.jButton2.setEnabled(true);
        }
    }//GEN-LAST:event_jCheckBox8ItemStateChanged

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        if (!"".equals(MainScreen.jTextField1.getText()) && MainScreen.jTextField1.isEnabled()) {            
                Engine eng = new Engine();
                String ip = MainScreen.jTextField1.getText();
                String cassetReference = this.jComboBox1.toString();
                String cassetSize = this.jComboBox2.toString();
                String MPTraySize = this.jComboBox3.toString();
                if (this.jCheckBox1.isSelected()) {
                    eng.command(eng.statusPage(), ip);
                }

                if (this.jCheckBox2.isSelected()) {
                    eng.command(eng.serviceStatusPage(), ip);
                }

                if (this.jCheckBox3.isSelected()) {
                    eng.command(eng.text(this.jTextArea1.getText()), ip);
                }

                if (this.jCheckBox4.isSelected()) {
                    eng.command(eng.originalName(), ip);
                }

                if (this.jCheckBox5.isSelected()) {
                    eng.command(eng.A4_LetterAnulate(), ip);
                }

                if (this.jCheckBox6.isSelected()) {
                    eng.command(eng.pressGOAnulate(), ip);
                }

                if (this.jCheckBox11.isSelected()) {
                    eng.command(eng.adjustCassetPaperSize(cassetReference, cassetSize), ip);
                }

                if (this.jCheckBox12.isSelected()) {
                    eng.command(eng.adjustMPTrayPaperSize(MPTraySize), ip);
                }

                if (this.jCheckBox9.isSelected()) {
                    eng.command(eng.adjustFiscalNoteModule1(), ip);
                }

                if (this.jCheckBox10.isSelected()) {
                    eng.command(eng.adjustFiscalNoteModule2(), ip);
                }
                if (this.jCheckBox7.isSelected() || this.jCheckBox8.isSelected()) {
                    int rs = JOptionPane.showConfirmDialog(rootPane, "Você deseja continuar?\n"
                            + "Essa configuração apagará todas as configurações do equipamento\n"
                            + "e será necessário reinicializa-lo novamnete.");
                    if (rs == 0) {                        
                        if(this.jCheckBox7.isSelected()){
                        eng.command(eng.resetAll(), ip);
                        } else if(this.jCheckBox8.isSelected()){
                            eng.command(eng.firmwareInt(), ip);
                        }
                    } else if (rs == 1) {                       
                    } else if (rs == 2) {                       
                    }
                }
            } else if("".equals(MainScreen.jTextField1.getText())) {      
            JOptionPane.showMessageDialog(rootPane, "Digite um nome ou ip válido para prosseguir.");
        } else {
                Engine eng = new Engine();
                String ip = MainScreen.jTextField1.getText();
                String cassetReference = this.jComboBox1.toString();
                String cassetSize = this.jComboBox2.toString();
                String MPTraySize = this.jComboBox3.toString();
                if (this.jCheckBox1.isSelected()) {
                    eng.commandShared(eng.statusPage());
                }

                if (this.jCheckBox2.isSelected()) {
                    eng.commandShared(eng.serviceStatusPage());
                }

                if (this.jCheckBox3.isSelected()) {
                    eng.commandShared(eng.text(this.jTextArea1.getText()));
                }

                if (this.jCheckBox4.isSelected()) {
                    eng.commandShared(eng.originalName());
                }

                if (this.jCheckBox5.isSelected()) {
                    eng.commandShared(eng.A4_LetterAnulate());
                }

                if (this.jCheckBox6.isSelected()) {
                    eng.commandShared(eng.pressGOAnulate());
                }

                if (this.jCheckBox11.isSelected()) {
                    eng.commandShared(eng.adjustCassetPaperSize(cassetReference, cassetSize));
                }

                if (this.jCheckBox12.isSelected()) {
                    eng.commandShared(eng.adjustMPTrayPaperSize(MPTraySize));
                }

                if (this.jCheckBox9.isSelected()) {
                    eng.commandShared(eng.adjustFiscalNoteModule1());
                }

                if (this.jCheckBox10.isSelected()) {
                    eng.commandShared(eng.adjustFiscalNoteModule2());
                }
                if (this.jCheckBox7.isSelected() || this.jCheckBox8.isSelected()) {
                    int rs = JOptionPane.showConfirmDialog(rootPane, "Você deseja continuar?\n"
                            + "Essa configuração apagará todas as configurações do equipamento\n"
                            + "e será necessário reinicializa-lo novamnete.");
                    if (rs == 0) {                        
                        if(this.jCheckBox7.isSelected()){
                        eng.commandShared(eng.resetAll());
                        } else if(this.jCheckBox8.isSelected()){
                            eng.commandShared(eng.firmwareInt());
                        }
                    } else if (rs == 1) {                       
                    } else if (rs == 2) {                       
                    }
                }
            }
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        Free free = new Free();
        if ("".equals(MainScreen.jTextField1.getText())) {
            JOptionPane.showMessageDialog(rootPane, "Digite um nome ou ip válido para prosseguir.");
        } else {
            free.setVisible(true);
        }
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        String Caminho = "C:\\Windows\\System32\\cmd.exe ";
        String cmd = "/C net use lpt1: \\\\";
        String ip = "";
        try {
            java.net.InetAddress i = java.net.InetAddress.getLocalHost();
            ip = i.getHostAddress() + "\\";
        } catch (Exception e) {
        }
        compartilhamento = JOptionPane.showInputDialog("Digite o nome do compartilhamento do sistema de impressão");
        String comando = Caminho + cmd + ip + compartilhamento;

        if (!"".equals(compartilhamento)) {
            try {
                Process p = Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + comando);
            } catch (IOException e) {
            }
            this.jLabel8.setText(compartilhamento + " está conectado >>");
            MainScreen.jTextField1.setText(ip);
            MainScreen.jTextField1.setEnabled(false);
            MainScreen.jTextField1.setEditable(false);
        } else {
            JOptionPane.showMessageDialog(null, "É preciso preencher com um nome de compartilhamento existente!");
            this.jLabel8.setText("Nenhum equipamento mapeado >>");
        }
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        String comando = "C:\\Windows\\System32\\cmd.exe /C "
                + "net use lpt1: /delete";
        try {
            Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + comando);
        } catch (IOException e) {
        }
        this.jLabel8.setText("Nenhum equipamento mapeado >>");
        MainScreen.jTextField1.setText("");
        MainScreen.jTextField1.setEnabled(true);
        MainScreen.jTextField1.setEditable(true);
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        String ip = JOptionPane.showInputDialog("Digite o IP deste computador");
        compartilhamento = JOptionPane.showInputDialog("Digite o nome do compartilhamento do sistema de impressão");
        String comando = "C:\\Windows\\System32\\cmd.exe /C "
                + "net use lpt1: \\\\" + ip + "\\" + compartilhamento;
        try {
            Process p = Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + comando);

        } catch (IOException e) {
        }
        this.jLabel8.setText(compartilhamento + " está conectado >>");
        MainScreen.jTextField1.setText(ip);
        MainScreen.jTextField1.setEnabled(false);
        MainScreen.jTextField1.setEditable(false);
    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        Sobre sb = new Sobre();
        sb.setVisible(true);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    public static void main(String args[]) {

        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainScreen().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JCheckBox jCheckBox10;
    private javax.swing.JCheckBox jCheckBox11;
    private javax.swing.JCheckBox jCheckBox12;
    private javax.swing.JCheckBox jCheckBox2;
    private javax.swing.JCheckBox jCheckBox3;
    private javax.swing.JCheckBox jCheckBox4;
    private javax.swing.JCheckBox jCheckBox5;
    private javax.swing.JCheckBox jCheckBox6;
    private javax.swing.JCheckBox jCheckBox7;
    private javax.swing.JCheckBox jCheckBox8;
    private javax.swing.JCheckBox jCheckBox9;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JComboBox jComboBox3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTextArea jTextArea1;
    public static javax.swing.JTextField jTextField1;
    // End of variables declaration//GEN-END:variables
}
